﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LK.Math
{
    public partial class BitsTest
    {
        public static void LeftZeroCount()
        {
            Log("LeftZeroCount Test Start");

            Random r = new Random();
           
            for (int i = 0; i < 1000000; ++i) {
                ulong val = ((ulong)r.Next() << 33) ^ ((ulong)r.Next() << 2) ^ ((ulong)r.Next());
                int mov;
                for (mov = 0; mov < 64 && (val >> (63 - mov)) == 0; mov++) ;
                if (mov != Bits.LeftZeroCount64(val)) {
                    Log("Error:val = " + val + " ,mov= " + mov + " ,blz= " + Bits.LeftZeroCount64(val));
                    System.Threading.Thread.Sleep(10000);
                }
            }


            Log("LeftZeroCount Test Done");

        }
    }
}
